<?php
use Yii;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\captcha\Captcha;
use app\modules\admin\assets\LoginAsset;
LoginAsset::register($this);
$js = <<<JS
$(function () {
    $('input').iCheck({
        checkboxClass: 'icheckbox_square-blue',
        radioClass: 'iradio_square-blue',
        increaseArea: '20%' /* optional */
    });
});
JS;
$this->registerJs($js, \yii\web\View::POS_END);
$css = <<<CSS
.icheck label {
    padding-left: 0;
}
CSS;

$this->registerCss($css);
?>
<?php $this->beginPage() ?>
<!doctype html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <?= Html::csrfMetaTags() ?>
    <title>登录</title>
    <?php $this->head() ?>
</head>
<body class="hold-transition login-page" style="height: auto;">
<?php $this->beginBody() ?>
<div class="login-box">
    <div class="login-logo">
        <a href="<?= Url::current() ?>"><b>Yii2</b> Admin</a>
    </div>
    <div class="login-box-body">
        <p class="login-box-msg">请在以下表单输入登录信息</p>
        <?php $form = ActiveForm::begin([
            'id' => $model->formName(),
            'fieldConfig' => [
                'options' => ['class' => 'form-group has-feedback']
            ],
        ]) ?>
        <?= $form->field($model, 'username', [
            'template' => '{input}<span class="glyphicon glyphicon-envelope form-control-feedback"></span><p>{error}</p>',
        ])->textInput(['placeholder' => '请输入用户名']) ?>
        <?= $form->field($model, 'password', [
            'template' => '{input}<span class="glyphicon glyphicon-lock form-control-feedback"></span><p>{error}</p>',
        ])->passwordInput(['placeholder' => '请输入密码']) ?>
        <?= $form->field($model, 'captcha', ['template' => '{input}<span class="glyphicon glyphicon-magnet form-control-feedback"></span><p>{error}</p>'])->widget(Captcha::className(), [
            'template' => '<div class="row"><div class="col-xs-4">{image}</div><div class="col-xs-8">{input}</div></div>',
            'captchaAction' => '/site/captcha',
        ]) ?>
        <div class="row">
            <div class="col-xs-8">
                <div class="checkbox icheck">
                    <?= $form->field($model, 'rememberMe', [
                        'template' => '{input}'
                    ])->checkbox() ?>
                </div>
            </div>
            <div class="col-xs-4">
                <?= Html::submitButton('登录', ['class' => 'btn btn-primary btn-block btn-flat']) ?>
            </div>
        </div>
        <?php ActiveForm::end() ?>
    </div>
</div>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

